/**
 * Created by lenovo on 2018/1/25.
 */

//全局搜索的js
define(['ngApp', 'ngHttp', 'jquery', 'ngConstant', 'ngAlert'], function (ngApp, ngHttp, JQ, ngConstant, ngAlert) {
    ngApp.controller("modifyPassword", function ($scope, $http, $timeout, $rootScope, $state, $uibModal, commonFn, $cookies,$window) {
        $('#mdy').height($(window).height());
        $scope.mdyBtn = function(){
            $scope.obj = {};
            $scope.obj.lgOldPwd = $scope.oldPassword;
            $scope.obj.lgnewPwd1 = $scope.newPassword1;
            $scope.obj.lgnewPwd2 = $scope.newPassword2;
            $http({
                url: ngConstant.interfaceHost + 'admin/infousers/editpwd',
                method: 'POST',
                data:$scope.obj,
                headers: {'Authorization':$cookies.get("token")}
            }).then(function(res){
                ngAlert.successMsg(res.data.data);
                $cookies.remove('token');
                $state.go('login');
            },function(res){
                ngAlert.errorMsg('修改失败');
            });

        };

    })
});


